package com.zhi.blog.validate;

import com.zhi.blog.domain.vo.AlbumVo;
import com.zhi.blog.mapper.AlbumMapper;
import com.zhi.common.exception.ServiceException;
import com.zhi.common.exception.base.BaseException;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @author ftz-lover
 * @version 1.0
 * @date 2023/9/10 15:40
 */
@Service
@Log4j2
public class AlbumServiceValidator {

    @Resource
    private  AlbumMapper baseMapper;

    public void queryById(Long id){
        AlbumVo albumVo = baseMapper.selectVoById(id);
        if (Objects.isNull(albumVo)){
            throw new BaseException("相册不存在或已被删除");
        }
    }

}
